<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf8">
            
            <style type="text/css">
                * {
                    font-size: 40px;
                }
            </style>
            
            <script language="javascript">

            //JS执行window.webkit.messageHandlers.Share.postMessage(<messageBody>)
            function shareClick() {
                window.webkit.messageHandlers.shareWeixinInfo.postMessage({content:'测试分享的内容'});
            }
            
            
            //JS执行window.webkit.messageHandlers.Camera.postMessage(<messageBody>)
            function payClick() {
                window.webkit.messageHandlers.weixinPay.postMessage({eName:'大盘鸡',ePrice:'999'});
            }
            
            function logout() {
                window.webkit.messageHandlers.logout.postMessage(null);
            }
            
            
            function callJsConfirm() {
                if (confirm('confirm123', 'Objective-C call js to show confirm')) {
                    document.getElementById('jsParamFuncSpan').innerHTML
                    = 'true';
                } else {
                    document.getElementById('jsParamFuncSpan').innerHTML
                    = 'false';
                }
            }

            function callJsInput() {
                var response = prompt('Hello', 'Please input your name:');
                document.getElementById('jsParamFuncSpan').innerHTML = response;
                
                window.webkit.messageHandlers.AppModel.postMessage({body: response});
            }
            
            function callJsInput() {
                var response = prompt('Hello', 'Please input your name:');
                document.getElementById('jsParamFuncSpan').innerHTML = response;
                
                window.webkit.messageHandlers.AppModel.postMessage({body: response});
            }
            
            function callJsAlert() {
                alert('这是一个晶化工阿卡');
            }
            
            // 注意哦，如果JS写错，可能在OC调用JS方法时，都会出错哦。
            var jsParamFunc = function(argument) {
                document.getElementById('jsParamFuncSpan').innerHTML
                = argument['name'];
            }
            showAler();
            
          </script>
            </head>
    
    <body>
        <h1>这是按钮调用</h1>
        <div><input type="button" value="call js alert" onclick="callJsAlert()"></div>

        <div><input type="button" value="Call js confirm" onclick="callJsConfirm()"></div><br/>
        
        <div><input type="button" value="Call js input" onclick="callJsInput()"></div><br/>

<!--        显示输入框获取的值-->
        <div id="SwiftDiv">
            <span id="jsParamFuncSpan" style="color: red; font-size: 50px;"></span>
        </div>

<!--        <input type="button" onclick="disp_alert()" value="显示警告框" />-->
<!--        -->
<!--        <input type="button" value="分享" onclick="shareClick()" />-->
<!--        <input type="button" value="支付" onclick="payClick()" />-->
<!--        <input type="button" value="退出登录" onclick="logout()" />-->
    </body>
</html>
